

<%@page import="cs4280.dao.MovieDAO"%>
<%--
    Document   : index
    Created on : 2011-3-22, 11:19:34
    Author     : PangPei
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList, java.util.Iterator, cs4280.bean.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <title>Web Movie System</title>

        <meta name="keywords" content="" />

        <meta name="description" content="" />

        <link href="default.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript" src="jquery/jquery-1.4.2.min.js"></script>

        <script type="text/javascript" src="jquery/jquery.slidertron-0.1.js"></script>

        
        <script type="text/javascript" src="jquery.twitter.js"></script>
        <link rel="stylesheet" href="jquery.twitter.css" type="text/css" media="all"/>

        <style type="text/css">

            @import "gallery.css";

        </style>
        <script type="text/javascript">
            function viewMovie(id) {
                document.getElementById("frmPage"+id).movieid.value=id;
                document.getElementById("frmPage"+id).submit();
            }

            function searchMovie() {
                if (document.getElementById("keyword").value.length>0)
                    document.getElementById("searchM").submit();
                else
                    alert("Please input the keyword to search");

            }
        </script>

        

        <style type="text/css">
            form#sortM label { margin-left: 10px; font-weight: bold; }
            form#sortM #sort { float: right; margin-right: 5px;}
        </style>
    </head>

    <body>



        <form name="frmPage" id="frmPage" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
            <input type="hidden" name="todo" id="todo" value="" />
            <input type="hidden" name="movieid" id="movieid" value="" />
        </form>
        <div id="wrapper">

            <div id="header">

                <div id="logo">

                    <h1><a href="#">webmoive </a></h1>

                    <h2><a href="http://www.freecsstemplates.org/">By Phoena and Yvonne</a></h2>

                </div>

                <!-- end div#logo -->

                <div id="menu">



                    <ul>

                        <form name="home" id="home" method="post" action="index.do">
                            <li ><a onclick="home.submit();" >Homepage</a></li>
                        </form>
                        
                            <li class="active"><a href="#" >Movies</a></li>
                        
                        <form name="discuss" id="discuss" method="post" action="/assignmentCinema/">
                            <input type="hidden" name="todo" id="todo" value="messageBox" />
                            <li><a onclick="discuss.submit();">Discuss</a></li>
                        </form>
                        <form name="manage" id="manage" method="post" action="memberControl.do">
                            <li><a onclick="manage.submit();">Manage</a></li>
                        </form>
                    </ul>



                </div>

                <!-- end div#menu -->

            </div>
        </div>

        <div>

            <div id="page">

                <div id="page-bgtop">

                    <div id="content">

                        <div id="gallery-bg">

                            <div id="gallery-bgtop">

                                <div id="gallery-bgbtm">

                                    <div id="foobar">

                                        <div class="navigation"> <a href="#" class="first">[ &lt;&lt; ]</a> &nbsp; <a href="#" class="previous">[ &lt; ]</a> &nbsp; <a href="#" class="next">[ &gt; ]</a> &nbsp; <a href="#" class="last">[ &gt;&gt; ]</a> </div>

                                        <div class="viewer">

                                            <div class="reel">

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                                <div class="slide"> <img src="images/img13.jpg" alt=""> <span>CYPP.</span> </div>

                                            </div>

                                        </div>

                                    </div>

                                    <script type="text/javascript">



                                        $('#foobar').slidertron({

                                            viewerSelector:			'.viewer',

                                            reelSelector:			'.viewer .reel',

                                            slidesSelector:			'.viewer .reel .slide',

                                            navPreviousSelector:	'.previous',

                                            navNextSelector:		'.next',

                                            navFirstSelector:		'.first',

                                            navLastSelector:		'.last'

                                        });



                                    </script>

                                    <!-- end -->

                                </div>

                            </div>

                        </div>
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">
                                        <form name="sortM" id="sortM" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
                                            <input type="hidden" id="todo" name="todo" value="doSort" />
                                            <label>Sort by:</label>
                                            <select name="sortStrategy" id="sortStrategy">
                                                <option>Name</option>
                                                <option>Opendate</option>
                                                <option>Duration</option>
                                            </select>
                                            <label>Order:</label>
                                            <input type="radio" name="order" value="ascending" checked="true"/> Ascending
                                            <input type="radio" name="order" value="descending" /> Descending
                                            <label>Show:</label>
                                            <input type="radio" name="numberPerPage" value="5" /> 5
                                            <input type="radio" name="numberPerPage" value="10" /> 10
                                            <input type="radio" name="numberPerPage" value="all" checked="true"/>all
                                            <input type="submit" id="sort" value="Sort" />
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">
                                        <form name="searchM" id="searchM" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
                                            <input type="hidden" id="todo" name="todo" value="doSearch" />
                                            Enter keyword(s) to look for all types of movies.<br />
                                            <input type="text" name="keyword" id="keyword" value="" />
                                            <input type="button" value="search" id="searchSubmit" onclick="searchMovie();" />
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%

                                    ArrayList<Movie> movies =
                                            (ArrayList<Movie>) request.getAttribute("movies");
                                    Iterator<Movie> it = movies.iterator();
                                    while (it.hasNext() != false) {
                                        pageContext.setAttribute("movie", (Movie) it.next());
                        %>
                        <jsp:useBean id="movie" type="cs4280.bean.Movie" scope="page"/>

                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">
                                        <form name="frmPage" id="frmPage<%=movie.getId()%>" method="post" action="<jsp:expression>(String) request.getAttribute("javax.servlet.forward.request_uri")</jsp:expression>">
                                            <input type="hidden" name="todo" id="todo" value="movieviewer" />
                                            <input type="hidden" name="movieid" id="movieid" value="" />
                                            <img class="film_prev" src="<%=movie.getImgurl()%>"/>
                                            <h2 class="title"><a href="#"><%=movie.getName()%></a></h2>
                                            <p>Date: <%=movie.getOpendate()%><br/>
                                                Duration: <%=String.valueOf(movie.getDuration())%> mins

                                                <input type="button" class="more" value="Book it!" />
                                                <input type="button" class="view" onclick="viewMovie(<%=movie.getId()%>);" value="view" />

                                            </p>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%}
                                    if (movies.size() == 0) {
                        %>
                        <div class="post">
                            <div class="post-bgtop">
                                <div class="post-bgbtm">
                                    <div class="entry">
                                        <p>Your search -<%=request.getAttribute("keyword")%>- did not match any documents.</p>
                                        Suggestions:<br />
                                        <ul>
                                            <li>-Make sure all words are spelled correctly.</li>
                                            <li>-Try different keywords.</li>
                                            <li>-Try more general keywords.</li>
                                            <li>-Try fewer keywords.</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <%}%>                     
                    </div>

                    <!-- end div#content -->

                    <div id="sidebar">

                        <div id="sidebar-bgtop">

                            <div id="sidebar-bgbtm">

                                <ul>

                                    <li id="login">

                                        <h2>User Login</h2>

                                        <jsp:include page="/WEB-INF/jsp/user.jsp"/>


                                    </li>

                                    <li>

                                        <div class="module">
                                        <div class="textwidget">
                                            <h2>CultCinema Tweets</h2>
                                            <script src="http://widgets.twimg.com/j/2/widget.js"></script>
                                            <script>
                                                new TWTR.Widget({
                                                    version: 2,
                                                    type: 'search',
                                                    search: '#cultcinema',
                                                    interval: 6000,
                                                    title: '',
                                                    subject: '',
                                                    width: 180,
                                                    height: 200,
                                                    theme: {
                                                        shell: {
                                                            background: '#CCCCCC',
                                                            color: '#ffffff'
                                                        },
                                                        tweets: {
                                                            background: '#ffffff',
                                                            color: '#444444',
                                                            links: '#458718'
                                                        }
                                                    },
                                                    features: {
                                                        scrollbar: false,
                                                        loop: true,
                                                        live: true,
                                                        hashtags: true,
                                                        timestamp: true,
                                                        avatars: true,
                                                        toptweets: true,
                                                        behavior: 'default'
                                                    }
                                                }).render().start();
                                            </script>
                                        </div>
                                    </div>
                                        <br/>
                                        <br/>
                                    </li>

                                    <li>

                                        <h2>Phasellus Tellus</h2>

                                        <ul>

                                            <li><a href="#">Eget tempor eget nonummy</a></li>

                                            <li><a href="#">Nec metus sed donec</a></li>

                                            <li><a href="#">Magna lacus bibendum mauris</a></li>

                                            <li><a href="#">Velit semper nisi molestie</a></li>

                                        </ul>

                                    </li>

                                </ul>

                            </div>

                        </div>

                    </div>

                    <!-- end div#sidebar -->

                    <div style="clear: both; height: 1px"></div>

                </div>

            </div>

            <!-- end div#page -->

        </div>

        <!-- end div#wrapper -->

        <div id="footer-wrapper">

            <div id="footer">

                <p id="legal">Copyright &copy; 2007 Vertebrate . All Rights Reserved. Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a>.</p>

                <p id="links"><a href="#">Privacy Policy</a> | <a href="#">Terms of Use</a></p>

            </div>

        </div>

        <!-- end div#footer -->

    </body>

</html>
